package com.user.config;

import com.user.utils.Constants;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Author : Yu
 * @Date 2023/8/17 22:47
 */
@Configuration
public class MyRedissonConfig {

    @Bean(destroyMethod = "shutdown")
    RedissonClient redisson() {
        Config config = new Config();
        config.useSingleServer().setAddress(Constants.REDIS_ADDRESS).setPassword(Constants.REDIS_PASSWORD);
        return Redisson.create(config);
    }
}
